/*
 * @Author: your name
 * @Date: 2021-01-18 09:25:33
 * @LastEditTime: 2021-02-23 11:46:38
 * @LastEditors: your name
 * @Description: In User Settings Edit
 * @FilePath: /shb-fe-pc/server/routes/customerContact.js
 */
const KoaRouter = require('koa-router')
const HttpClient = require('../util/HttpClient')
const Template = require('../util/Template')

const router = new KoaRouter();
const modules = require('../../modules');

router.get('/customerContact', async ctx => {
  let script = ['/customerContact.home.js'];
  let modConfig = modules['customerContact.home'];
  let reqHeaders = ctx.request.headers;
  let result = await HttpClient.request(`/customerContact/${ctx.params.type}`, 'get', null, {headers: reqHeaders});
  let body = result.body;
  
  ctx.body = await Template.renderWithHtml('客户联系人', body, script, modConfig.template, ctx)
});

router.get('/linkman/jump/list', async ctx => {
  let script = ['/customerContact.home.js'];
  let modConfig = modules['customerContact.home'];
  let reqHeaders = ctx.request.headers;
  let result = await HttpClient.request('/linkman/jump/list', 'get', null, {headers: reqHeaders});
  let body = result.body;
  
  ctx.body = await Template.renderWithHtml('客户联系人', body, script, modConfig.template, ctx)
});

module.exports = router;
